CREATE TABLE SCHEDULE_JOB (
  ID INT NOT NULL,
  JOB_ID VARCHAR2 ( 255 ) DEFAULT NULL,
  JOB_NAME VARCHAR2 ( 255 ) DEFAULT NULL,
  JOB_STATUS VARCHAR2 ( 255 ) DEFAULT NULL,
  JOB_GROUP VARCHAR2 ( 255 ) DEFAULT NULL,
  CRON_EXPRESSION VARCHAR2 ( 255 ) DEFAULT NULL,
  DESCRIPTION VARCHAR2 ( 255 ) DEFAULT NULL,
  BEAN_NAME VARCHAR2 ( 255 ) DEFAULT NULL,
  METHOD_NAME VARCHAR2 ( 255 ) DEFAULT NULL,
  PRIMARY KEY ( ID ) 
);
-- 存储每一个已配置的 JOB 的详细信息
CREATE TABLE QRTZ_JOB_DETAILS (
  SCHED_NAME VARCHAR2 ( 120 ) NOT NULL,
  JOB_NAME VARCHAR2 ( 200 ) NOT NULL,
  JOB_GROUP VARCHAR2 ( 200 ) NOT NULL,
  DESCRIPTION VARCHAR2 ( 250 ) NULL,
  JOB_CLASS_NAME VARCHAR2 ( 250 ) NOT NULL,
  IS_DURABLE VARCHAR2 ( 1 ) NOT NULL,
  IS_NONCONCURRENT VARCHAR2 ( 1 ) NOT NULL,
  IS_UPDATE_DATA VARCHAR2 ( 1 ) NOT NULL,
  REQUESTS_RECOVERY VARCHAR2 ( 1 ) NOT NULL,
  JOB_DATA BLOB NULL,
  CONSTRAINT QRTZ_JOB_DETAILS_PK PRIMARY KEY ( SCHED_NAME, JOB_NAME, JOB_GROUP ) 
);
--  存储已配置的 TRIGGER 的信息
CREATE TABLE QRTZ_TRIGGERS (
  SCHED_NAME VARCHAR2 ( 120 ) NOT NULL,
  TRIGGER_NAME VARCHAR2 ( 200 ) NOT NULL,
  TRIGGER_GROUP VARCHAR2 ( 200 ) NOT NULL,
  JOB_NAME VARCHAR2 ( 200 ) NOT NULL,
  JOB_GROUP VARCHAR2 ( 200 ) NOT NULL,
  DESCRIPTION VARCHAR2 ( 250 ) NULL,
  NEXT_FIRE_TIME NUMBER ( 13 ) NULL,
  PREV_FIRE_TIME NUMBER ( 13 ) NULL,
  PRIORITY NUMBER ( 13 ) NULL,
  TRIGGER_STATE VARCHAR2 ( 16 ) NOT NULL,
  TRIGGER_TYPE VARCHAR2 ( 8 ) NOT NULL,
  START_TIME NUMBER ( 13 ) NOT NULL,
  END_TIME NUMBER ( 13 ) NULL,
  CALENDAR_NAME VARCHAR2 ( 200 ) NULL,
  MISFIRE_INSTR NUMBER ( 2 ) NULL,
  JOB_DATA BLOB NULL,
  CONSTRAINT QRTZ_TRIGGERS_PK PRIMARY KEY ( SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP ),
  CONSTRAINT QRTZ_TRIGGER_TO_JOBS_FK FOREIGN KEY ( SCHED_NAME, JOB_NAME, JOB_GROUP ) REFERENCES QRTZ_JOB_DETAILS ( SCHED_NAME, JOB_NAME, JOB_GROUP ) 
);
-- 存储简单的 TRIGGER，包括重复次数，间隔，以及已触的次数
CREATE TABLE QRTZ_SIMPLE_TRIGGERS (
  SCHED_NAME VARCHAR2 ( 120 ) NOT NULL,
  TRIGGER_NAME VARCHAR2 ( 200 ) NOT NULL,
  TRIGGER_GROUP VARCHAR2 ( 200 ) NOT NULL,
  REPEAT_COUNT NUMBER ( 7 ) NOT NULL,
  REPEAT_INTERVAL NUMBER ( 12 ) NOT NULL,
  TIMES_TRIGGERED NUMBER ( 10 ) NOT NULL,
  CONSTRAINT QRTZ_SIMPLE_TRIG_PK PRIMARY KEY ( SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP ),
  CONSTRAINT QRTZ_SIMPLE_TRIG_TO_TRIG_FK FOREIGN KEY ( SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP ) REFERENCES QRTZ_TRIGGERS ( SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP ) 
);
-- 存储 CRON TRIGGER，包括 CRON 表达式和时区信息
CREATE TABLE QRTZ_CRON_TRIGGERS (
  SCHED_NAME VARCHAR2 ( 120 ) NOT NULL,
  TRIGGER_NAME VARCHAR2 ( 200 ) NOT NULL,
  TRIGGER_GROUP VARCHAR2 ( 200 ) NOT NULL,
  CRON_EXPRESSION VARCHAR2 ( 120 ) NOT NULL,
  TIME_ZONE_ID VARCHAR2 ( 80 ),
  CONSTRAINT QRTZ_CRON_TRIG_PK PRIMARY KEY ( SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP ),
  CONSTRAINT QRTZ_CRON_TRIG_TO_TRIG_FK FOREIGN KEY ( SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP ) REFERENCES QRTZ_TRIGGERS ( SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP ) 
);
CREATE TABLE QRTZ_SIMPROP_TRIGGERS (
  SCHED_NAME VARCHAR2 ( 120 ) NOT NULL,
  TRIGGER_NAME VARCHAR2 ( 200 ) NOT NULL,
  TRIGGER_GROUP VARCHAR2 ( 200 ) NOT NULL,
  STR_PROP_1 VARCHAR2 ( 512 ) NULL,
  STR_PROP_2 VARCHAR2 ( 512 ) NULL,
  STR_PROP_3 VARCHAR2 ( 512 ) NULL,
  INT_PROP_1 NUMBER ( 10 ) NULL,
  INT_PROP_2 NUMBER ( 10 ) NULL,
  LONG_PROP_1 NUMBER ( 13 ) NULL,
  LONG_PROP_2 NUMBER ( 13 ) NULL,
  DEC_PROP_1 NUMERIC ( 13, 4 ) NULL,
  DEC_PROP_2 NUMERIC ( 13, 4 ) NULL,
  BOOL_PROP_1 VARCHAR2 ( 1 ) NULL,
  BOOL_PROP_2 VARCHAR2 ( 1 ) NULL,
  CONSTRAINT QRTZ_SIMPROP_TRIG_PK PRIMARY KEY ( SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP ),
  CONSTRAINT QRTZ_SIMPROP_TRIG_TO_TRIG_FK FOREIGN KEY ( SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP ) REFERENCES QRTZ_TRIGGERS ( SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP ) 
);
-- TRIGGER 作为 BLOB 类型存储(用于 QUARTZ 用户用 JDBC 创建他们自己定制的 TRIGGER 类型，<SPAN STYLE="color:#800080;">JOBSTORE</SPAN> 并不知道如何存储实例的时候)
CREATE TABLE QRTZ_BLOB_TRIGGERS (
  SCHED_NAME VARCHAR2 ( 120 ) NOT NULL,
  TRIGGER_NAME VARCHAR2 ( 200 ) NOT NULL,
  TRIGGER_GROUP VARCHAR2 ( 200 ) NOT NULL,
  BLOB_DATA BLOB NULL,
  CONSTRAINT QRTZ_BLOB_TRIG_PK PRIMARY KEY ( SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP ),
  CONSTRAINT QRTZ_BLOB_TRIG_TO_TRIG_FK FOREIGN KEY ( SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP ) REFERENCES QRTZ_TRIGGERS ( SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP ) 
);
-- 以 BLOB 类型存储 QUARTZ 的 CALENDAR 信息
CREATE TABLE QRTZ_CALENDARS (
  SCHED_NAME VARCHAR2 ( 120 ) NOT NULL,
  CALENDAR_NAME VARCHAR2 ( 200 ) NOT NULL,
  CALENDAR BLOB NOT NULL,
  CONSTRAINT QRTZ_CALENDARS_PK PRIMARY KEY ( SCHED_NAME, CALENDAR_NAME ) 
);
-- 存储已暂停的 TRIGGER 组的信息
CREATE TABLE QRTZ_PAUSED_TRIGGER_GRPS ( SCHED_NAME VARCHAR2 ( 120 ) NOT NULL, TRIGGER_GROUP VARCHAR2 ( 200 ) NOT NULL, CONSTRAINT QRTZ_PAUSED_TRIG_GRPS_PK PRIMARY KEY ( SCHED_NAME, TRIGGER_GROUP ) );
-- 存储与已触发的 TRIGGER 相关的状态信息，以及相联 JOB 的执行信息
CREATE TABLE QRTZ_FIRED_TRIGGERS (
  SCHED_NAME VARCHAR2 ( 120 ) NOT NULL,
  ENTRY_ID VARCHAR2 ( 95 ) NOT NULL,
  TRIGGER_NAME VARCHAR2 ( 200 ) NOT NULL,
  TRIGGER_GROUP VARCHAR2 ( 200 ) NOT NULL,
  INSTANCE_NAME VARCHAR2 ( 200 ) NOT NULL,
  FIRED_TIME NUMBER ( 13 ) NOT NULL,
  SCHED_TIME NUMBER ( 13 ) NOT NULL,
  PRIORITY NUMBER ( 13 ) NOT NULL,
  STATE VARCHAR2 ( 16 ) NOT NULL,
  JOB_NAME VARCHAR2 ( 200 ) NULL,
  JOB_GROUP VARCHAR2 ( 200 ) NULL,
  IS_NONCONCURRENT VARCHAR2 ( 1 ) NULL,
  REQUESTS_RECOVERY VARCHAR2 ( 1 ) NULL,
  CONSTRAINT QRTZ_FIRED_TRIGGER_PK PRIMARY KEY ( SCHED_NAME, ENTRY_ID ) 
);
-- 存储少量的有关 SCHEDULER 的状态信息，和别的 SCHEDULER 实例(假如是用于一个集群中)
CREATE TABLE QRTZ_SCHEDULER_STATE (
  SCHED_NAME VARCHAR2 ( 120 ) NOT NULL,
  INSTANCE_NAME VARCHAR2 ( 200 ) NOT NULL,
  LAST_CHECKIN_TIME NUMBER ( 13 ) NOT NULL,
  CHECKIN_INTERVAL NUMBER ( 13 ) NOT NULL,
  CONSTRAINT QRTZ_SCHEDULER_STATE_PK PRIMARY KEY ( SCHED_NAME, INSTANCE_NAME ) 
);
-- 存储程序的悲观锁的信息(假如使用了悲观锁)
CREATE TABLE QRTZ_LOCKS ( SCHED_NAME VARCHAR2 ( 120 ) NOT NULL, LOCK_NAME VARCHAR2 ( 40 ) NOT NULL, CONSTRAINT QRTZ_LOCKS_PK PRIMARY KEY ( SCHED_NAME, LOCK_NAME ) );

-- ----------------------------
-- TABLE STRUCTURE FOR SYS_JOB
-- ----------------------------
CREATE TABLE SYS_JOB (
  JOB_ID INT NOT NULL,
  JOB_NAME VARCHAR ( 64 ) NOT NULL,
  JOB_GROUP VARCHAR ( 64 ) NOT NULL,
  JOB_ORDER CHAR ( 1 ) DEFAULT '1',
  JOB_TYPE CHAR ( 1 ) DEFAULT '1' NOT NULL,
  EXECUTE_PATH VARCHAR ( 500 ) DEFAULT NULL,
  CLASS_NAME VARCHAR ( 500 ) DEFAULT NULL,
  METHOD_NAME VARCHAR ( 500 ) DEFAULT NULL,
  METHOD_PARAMS_VALUE VARCHAR ( 2000 ) DEFAULT NULL,
  CRON_EXPRESSION VARCHAR ( 255 ) DEFAULT NULL,
  MISFIRE_POLICY VARCHAR ( 20 ) DEFAULT '3',
  JOB_TENANT_TYPE CHAR ( 1 ) DEFAULT '1',
  JOB_STATUS CHAR ( 1 ) DEFAULT '0',
  JOB_EXECUTE_STATUS CHAR ( 1 ) DEFAULT '0',
  CREATE_BY VARCHAR ( 64 ) DEFAULT NULL,
  CREATE_TIME TIMESTAMP DEFAULT SYSDATE NOT NULL,
  UPDATE_BY VARCHAR ( 64 ) DEFAULT NULL,
  UPDATE_TIME TIMESTAMP DEFAULT SYSDATE NOT NULL,
  START_TIME TIMESTAMP NULL,
  PREVIOUS_TIME TIMESTAMP NULL,
  NEXT_TIME TIMESTAMP NULL,
  TENANT_ID INT DEFAULT '1',
  REMARK VARCHAR ( 500 ) NULL,
  CONSTRAINT SYS_JOB_PK PRIMARY KEY ( JOB_ID, JOB_NAME, JOB_GROUP ) 
);
COMMENT ON TABLE SYS_JOB IS '定时任务调度表';
COMMENT ON COLUMN SYS_JOB.JOB_ID IS '任务id';
COMMENT ON COLUMN SYS_JOB.JOB_NAME IS '任务名称';
COMMENT ON COLUMN SYS_JOB.JOB_GROUP IS '任务组名';
COMMENT ON COLUMN SYS_JOB.JOB_ORDER IS '组内执行顺利，值越大执行优先级越高，最大值9，最小值1';
COMMENT ON COLUMN SYS_JOB.JOB_TYPE IS '1、java类;2、spring bean名称;3、rest调用;4、jar调用;9其他';
COMMENT ON COLUMN SYS_JOB.EXECUTE_PATH IS 'job_type=3时，rest调用地址，仅支持rest get协议,需要增加String返回值，0成功，1失败;job_type=4时，jar路径;其它值为空';
COMMENT ON COLUMN SYS_JOB.CLASS_NAME IS 'job_type=1时，类完整路径;job_type=2时，spring bean名称;其它值为空';
COMMENT ON COLUMN SYS_JOB.METHOD_NAME IS '任务方法';
COMMENT ON COLUMN SYS_JOB.METHOD_PARAMS_VALUE IS '参数值';
COMMENT ON COLUMN SYS_JOB.CRON_EXPRESSION IS 'cron执行表达式';
COMMENT ON COLUMN SYS_JOB.MISFIRE_POLICY IS '错失执行策略（1错失周期立即执行 2错失周期执行一次 3下周期执行）';
COMMENT ON COLUMN SYS_JOB.JOB_TENANT_TYPE IS '1、多租户任务;2、非多租户任务';
COMMENT ON COLUMN SYS_JOB.JOB_STATUS IS '状态（1、未发布;2、运行中;3、暂停;4、删除;）';
COMMENT ON COLUMN SYS_JOB.JOB_EXECUTE_STATUS IS '状态（0正常 1异常）';
COMMENT ON COLUMN SYS_JOB.CREATE_BY IS '创建者';
COMMENT ON COLUMN SYS_JOB.CREATE_TIME IS '创建时间';
COMMENT ON COLUMN SYS_JOB.UPDATE_TIME IS '更新时间';
COMMENT ON COLUMN SYS_JOB.UPDATE_BY IS '更新者';
COMMENT ON COLUMN SYS_JOB.START_TIME IS '初次执行时间';
COMMENT ON COLUMN SYS_JOB.PREVIOUS_TIME IS '上次执行时间';
COMMENT ON COLUMN SYS_JOB.NEXT_TIME IS '下次执行时间';
COMMENT ON COLUMN SYS_JOB.TENANT_ID IS '租户';
COMMENT ON COLUMN SYS_JOB.REMARK IS '备注信息';
-- ----------------------------
-- TABLE STRUCTURE FOR SYS_JOB_LOG
-- ----------------------------
CREATE TABLE SYS_JOB_LOG (
  JOB_LOG_ID INT NOT NULL,
  JOB_ID INT NOT NULL,
  JOB_NAME VARCHAR ( 64 ) DEFAULT NULL,
  JOB_GROUP VARCHAR ( 64 ) DEFAULT NULL,
  JOB_ORDER CHAR ( 1 ) DEFAULT NULL,
  JOB_TYPE CHAR ( 1 ) DEFAULT '1' NOT NULL,
  EXECUTE_PATH VARCHAR ( 500 ) DEFAULT NULL,
  CLASS_NAME VARCHAR ( 500 ) DEFAULT NULL,
  METHOD_NAME VARCHAR ( 500 ) DEFAULT NULL,
  METHOD_PARAMS_VALUE VARCHAR ( 2000 ) DEFAULT NULL,
  CRON_EXPRESSION VARCHAR ( 255 ) DEFAULT NULL,
  JOB_MESSAGE VARCHAR ( 500 ) DEFAULT NULL,
  JOB_LOG_STATUS CHAR ( 1 ) DEFAULT '0',
  EXECUTE_TIME VARCHAR ( 30 ) DEFAULT NULL,
  EXCEPTION_INFO VARCHAR ( 2000 ) DEFAULT '',
  CREATE_TIME TIMESTAMP DEFAULT SYSDATE NOT NULL,
  TENANT_ID INT DEFAULT '1' NOT NULL,
  CONSTRAINT SYS_JOB_LOG_PK PRIMARY KEY ( JOB_LOG_ID ) 
);
COMMENT ON TABLE SYS_JOB_LOG IS '定时任务执行日志表';
COMMENT ON COLUMN SYS_JOB_LOG.JOB_LOG_ID IS '任务日志ID';
COMMENT ON COLUMN SYS_JOB_LOG.JOB_ID IS '任务id';
COMMENT ON COLUMN SYS_JOB_LOG.JOB_NAME IS '任务名称';
COMMENT ON COLUMN SYS_JOB_LOG.JOB_ORDER IS '组内执行顺利，值越大执行优先级越高，最大值9，最小值1';
COMMENT ON COLUMN SYS_JOB_LOG.JOB_TYPE IS '1、java类;2、spring bean名称;3、rest调用;4、jar调用;9其他';
COMMENT ON COLUMN SYS_JOB_LOG.EXECUTE_PATH IS 'job_type=3时，rest调用地址，仅支持post协议;job_type=4时，jar路径;其它值为空';
COMMENT ON COLUMN SYS_JOB_LOG.CLASS_NAME IS 'job_type=1时，类完整路径;job_type=2时，spring bean名称;其它值为空';
COMMENT ON COLUMN SYS_JOB_LOG.METHOD_NAME IS '任务方法';
COMMENT ON COLUMN SYS_JOB_LOG.METHOD_PARAMS_VALUE IS '参数值';
COMMENT ON COLUMN SYS_JOB_LOG.CRON_EXPRESSION IS 'cron执行表达式';
COMMENT ON COLUMN SYS_JOB_LOG.JOB_GROUP IS '任务组名';
COMMENT ON COLUMN SYS_JOB_LOG.JOB_MESSAGE IS '执行状态（0正常 1失败）';
COMMENT ON COLUMN SYS_JOB_LOG.JOB_LOG_STATUS IS '状态（1、未发布;2、运行中;3、暂停;4、删除;）';
COMMENT ON COLUMN SYS_JOB_LOG.EXECUTE_TIME IS '执行时间';
COMMENT ON COLUMN SYS_JOB_LOG.EXCEPTION_INFO IS '异常信息';
COMMENT ON COLUMN SYS_JOB_LOG.CREATE_TIME IS '创建时间';
COMMENT ON COLUMN SYS_JOB_LOG.TENANT_ID IS '租户id';

CREATE INDEX IDX_QRTZ_J_REQ_RECOVERY ON QRTZ_JOB_DETAILS ( SCHED_NAME, REQUESTS_RECOVERY );
CREATE INDEX IDX_QRTZ_J_GRP ON QRTZ_JOB_DETAILS ( SCHED_NAME, JOB_GROUP );
CREATE INDEX IDX_QRTZ_T_J ON QRTZ_TRIGGERS ( SCHED_NAME, JOB_NAME, JOB_GROUP );
CREATE INDEX IDX_QRTZ_T_JG ON QRTZ_TRIGGERS ( SCHED_NAME, JOB_GROUP );
CREATE INDEX IDX_QRTZ_T_C ON QRTZ_TRIGGERS ( SCHED_NAME, CALENDAR_NAME );
CREATE INDEX IDX_QRTZ_T_G ON QRTZ_TRIGGERS ( SCHED_NAME, TRIGGER_GROUP );
CREATE INDEX IDX_QRTZ_T_STATE ON QRTZ_TRIGGERS ( SCHED_NAME, TRIGGER_STATE );
CREATE INDEX IDX_QRTZ_T_N_STATE ON QRTZ_TRIGGERS ( SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP, TRIGGER_STATE );
CREATE INDEX IDX_QRTZ_T_N_G_STATE ON QRTZ_TRIGGERS ( SCHED_NAME, TRIGGER_GROUP, TRIGGER_STATE );
CREATE INDEX IDX_QRTZ_T_NEXT_FIRE_TIME ON QRTZ_TRIGGERS ( SCHED_NAME, NEXT_FIRE_TIME );
CREATE INDEX IDX_QRTZ_T_NFT_ST ON QRTZ_TRIGGERS ( SCHED_NAME, TRIGGER_STATE, NEXT_FIRE_TIME );
CREATE INDEX IDX_QRTZ_T_NFT_MISFIRE ON QRTZ_TRIGGERS ( SCHED_NAME, MISFIRE_INSTR, NEXT_FIRE_TIME );
CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE ON QRTZ_TRIGGERS ( SCHED_NAME, MISFIRE_INSTR, NEXT_FIRE_TIME, TRIGGER_STATE );
CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE_GRP ON QRTZ_TRIGGERS ( SCHED_NAME, MISFIRE_INSTR, NEXT_FIRE_TIME, TRIGGER_GROUP, TRIGGER_STATE );
CREATE INDEX IDX_QRTZ_FT_TRIG_INST_NAME ON QRTZ_FIRED_TRIGGERS ( SCHED_NAME, INSTANCE_NAME );
CREATE INDEX IDX_QRTZ_FT_INST_JOB_REQ_RCVRY ON QRTZ_FIRED_TRIGGERS ( SCHED_NAME, INSTANCE_NAME, REQUESTS_RECOVERY );
CREATE INDEX IDX_QRTZ_FT_J_G ON QRTZ_FIRED_TRIGGERS ( SCHED_NAME, JOB_NAME, JOB_GROUP );
CREATE INDEX IDX_QRTZ_FT_JG ON QRTZ_FIRED_TRIGGERS ( SCHED_NAME, JOB_GROUP );
CREATE INDEX IDX_QRTZ_FT_T_G ON QRTZ_FIRED_TRIGGERS ( SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP );
CREATE INDEX IDX_QRTZ_FT_TG ON QRTZ_FIRED_TRIGGERS ( SCHED_NAME, TRIGGER_GROUP );

-- 创建SYS_JOB SEQUENCE
CREATE SEQUENCE SYS_JOB_AUTO_SEQ NOMAXVALUE INCREMENT BY 1 START WITH 1 NOCYCLE;
-- 创建SYS_JOB_LOG SEQUENCE
CREATE SEQUENCE SYS_JOB_LOG_AUTO_SEQ NOMAXVALUE INCREMENT BY 1 START WITH 1 NOCYCLE;

-- 创建SYS_JOB和SYS_JOB_LOG触发器TRIGGER
CREATE OR REPLACE TRIGGER SYS_JOB_TRIGGER 
  BEFORE INSERT 
  ON SYS_JOB 
  FOR EACH ROW
DECLARE
BEGIN
  SELECT
    SYS_JOB_AUTO_SEQ.NEXTVAL INTO :NEW.JOB_ID 
  FROM
    DUAL;
END;
/
CREATE OR REPLACE TRIGGER SYS_JOB_LOG_TRIGGER  
  BEFORE INSERT  
  ON SYS_JOB_LOG  
  FOR EACH ROW  
DECLARE
BEGIN
  SELECT
    SYS_JOB_LOG_AUTO_SEQ.NEXTVAL INTO :NEW.JOB_LOG_ID 
  FROM
  DUAL;
END;